<?php 
$path = $settings['path'];
$sfile = file_get_contents($system['workdir'] . "settings.php");
if (!is_numeric(strpos($sfile, "path"))) {
	$path = "Portable";
}


$content = "
<div style='min-width:70%; margin: 0 auto; display:inline-block; background-color:white; padding:20px; border-radius:10px;'>
	<h1>".$loc_string['settings_title']."</h1>

	<div style='width:85%; display:flex; min-height:120px; margin:0 auto; border-bottom:2px solid #aaa;'>
		<div style='flex:1; min-height:120px; max-width:120px;'  class='settings-image'>
			<img style='max-height:80px; margin-top:50%; margin-left:20px;' src='./assets/globe.svg'>
		</div>
		<div style='width:100%;'>
			<form method='post' action='action.php' enctype='multipart/form-data'>
			<input type='hidden' name='mode' value='setsettings'>
			<div style='flex:1; min-height:120px; display:flex;'>
				<div style='flex:1;'>
					<h5>".$loc_string['settings_locale']."</h5>
					<select name='settings[locale]'>
						<option value='english' ".($settings['locale'] == "english" ? "selected":"").">English</option>
						<option value='spanish' ".($settings['locale'] == "spanish" ? "selected":"").">Español</option>
						<option value='german' ".($settings['locale'] == "german" ? "selected":"").">Deutsch</option>
						<option value='italian' ".($settings['locale'] == "italian" ? "selected":"").">Italiano</option>
						<option value='french' ".($settings['locale'] == "french" ? "selected":"").">Français</option>
						<option value='portuguese' ".($settings['locale'] == "portuguese" ? "selected":"").">Portuguese</option>
						<option value='japanese' ".($settings['locale'] == "japanese" ? "selected":"").">日本語</option>
					</select>	
				</div>
				<div style='flex:1;'>
					<h5>".$loc_string['settings_timezone_title']."</h5>
					<select id='timezone' name='settings[timezone]'>
					";
$timezones = [
    'America/Anchorage' => 'Anchorage, USA',
    'America/Asuncion' => 'Asunción, Paraguay',
    'Europe/Berlin' => 'Berlín, Germany',
    'America/Bogota' => 'Bogotá, Colombia',
    'America/Buenos_Aires' => 'Buenos Aires, Argentina',
    'America/Caracas' => 'Caracas, Venezuela',
    'America/Chicago' => 'Chicago, USA',
    'America/Guatemala' => 'Ciudad de Guatemala, Guatemala',
    'America/Mexico_City' => 'Ciudad de México, Mexico',
    'America/Panama' => 'Ciudad de Panamá, Panama',
    'America/Denver' => 'Denver, USA',
    'Asia/Kolkata' => 'Delhi, India', // Updated to use the correct timezone
    'Asia/Dubai' => 'Dubái, United Arab Emirates',
    'America/New_York' => 'Florida, USA', // Changed from America/Florida
    'America/Guayaquil' => 'Guayaquil, Ecuador',
    'Pacific/Honolulu' => 'Honolulu, USA',
    'Africa/Johannesburg' => 'Johannesburgo, South Africa',
    'America/La_Paz' => 'La Paz, Bolivia',
    'Europe/London' => 'Londres, United Kingdom',
    'America/Los_Angeles' => 'Los Ángeles, USA',
    'America/Lima' => 'Lima, Peru',
    'Europe/Madrid' => 'Madrid, Spain',
    'Europe/Moscow' => 'Moscú, Russia',
    'America/Managua' => 'Managua, Nicaragua',
    'America/Montevideo' => 'Montevideo, Uruguay',
    'America/New_York' => 'Nueva York, USA',
    'Europe/Paris' => 'París, France',
    'Europe/Rome' => 'Rome, Italy',
    'America/Phoenix' => 'Phoenix, USA',
    'America/San_Jose' => 'San José, Costa Rica',
    'America/Santiago' => 'Santiago, Chile',
    'America/Sao_Paulo' => 'São Paulo, Brazil',
    'Asia/Shanghai' => 'Shanghái, China',
    'Asia/Singapore' => 'Singapur, Singapore',
    'Australia/Sydney' => 'Sídney, Australia',
    'America/Tegucigalpa' => 'Tegucigalpa, Honduras',
    'Asia/Tokyo' => 'Tokio, Japan'
];
		foreach ($timezones as $timezone => $city){
			$content .= "<option value='".$timezone."' ".($settings['timezone'] == $timezone ? "selected" : "").">".$city."</option>";
		}

$content .= " </select>
					<br><small>".$loc_string['settings_timezone_select']."</small>
				</div>
			</div>
			<input type='submit' class='button' value='".$loc_string['save_button']."'>
			</form>
			<br>
		</div>
	</div>
	
	<div style='width:85%; display:flex; min-height:120px; margin:0 auto; border-bottom:2px solid #aaa;'>
		<div style='flex:1; min-height:120px; max-width:120px;' class='settings-image'> 
			<img style='max-height:80px; margin-top:50%;' src='./assets/database.svg'>
		</div>
		<div style='flex:1; min-height:120px;'>
			<br><b>".$loc_string['settings_db_title']."</b>
			<br><br>
			".$loc_string['settings_db_loc'].":<br> <b>".$path."</b>
			<br><br>
			<div style='display:flex; width:100%;'>
				<div style='flex:1;'>
					<div class='settings-button' onClick='getDialog(\"message_move_db\");'>
					<span style='display:block; font-family:dbicons; font-size:58px; margin:10px 0px;'></span>
					".$loc_string['settings_move_db']."
					</div>
				</div>
				<div style='flex:1;'>
					<div class='settings-button' onClick='getDialog(\"message_move_db_loc\");'>
					<span style='display:block; font-family:dbicons; font-size:58px; margin:10px 0px;'></span>
					".$loc_string['settings_move_db_loc']."
					</div>
				</div>
				<!--
				<div style='flex:1;'>
					<div class='settings-button'>
					<span style='display:block; font-family:dbicons; font-size:58px; margin:10px 0px;'></span>
					".$loc_string['settings_upload_db']."
					</div>
				</div>
				-->
			</div>
					<br>
		</div>
	</div>
</div>";

echo renderPage($content);

